<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>自由组队</title>
    <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"/>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <link rel="stylesheet" href="/css/common.css">
    <link rel="stylesheet" href="/css/minus.css">
    <link rel="stylesheet" href="/css/bootstrap.css">
    <link rel="stylesheet" href="/layui/extend/dtree.css">
    <link rel="stylesheet" href="/layui/extend/font/dtreefont.css">
    <link rel="stylesheet" href="/layui/extend/formSelects-v4.css">
</head>
<body>
    <div class="yadmin-body animated fadeIn">
        <form action="" method="get" class="layui-form layui-form-pane">
            <div class="layui-form-item">

                <input type="hidden" id="waiterId">
            </div>
            <div class="layui-form-item">

            </div>
            <div class="layui-form-item">

            </div>

            <div class="layui-form-item">
                <label for="teamMessage" class="layui-form-label">
                    组队信息
                </label>
                <div class="layui-input-block">
                    <input type="text" id="teamMessage" name="teamMessage"  placeholder="请填入组队信息"
                           lay-verify="required" lay-vertype="tips"
                           autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block" style="margin-left:0;text-align:center;">
                    <input type="hidden" id="userId" name="userId">
                </div>
            </div>
        </form>
        <div>
        <button class="layui-btn layui-btn-normal btn-w100" style="display:block;margin:0 auto"
                onclick="toAjax()" lay-filter="purchase">确定</button></div>
    </div>

    <script src="/layui/layui.js"></script>
    <script src="/js/common.js"></script>

    <script>
        layui.config({
            base: '/layui/extend/'
        }).extend({
            formSelects: 'formSelects-v4'
        }).use(['form', 'layer'], function () {
            $ = layui.jquery;
            var form = layui.form
                , layer = layui.layer;

            $(function(){
                var userId = parent.userId;
                $("#userId").val(userId);
            });

        });

    </script>
<script>
    function toAjax() {
        var message="";
        $.ajax({
            type: "GET",
            url: "/visitor/addTeam",
            data: {userId:$("#userId").val(),teamMessage:$("#teamMessage").val()},
            dataType: "json",
            success:function(res){
                message=res.data;
                parent.window.message=message;
            }
        });
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index); //再执行关闭
    }
</script>
</body>
</html>